var dataTable = {
		_id : "",
		_url : "",
		_params : {},
		_columns : [],
		loadDatas : function(config){
			var scope = this;
			scope._id = config._id;
			scope._url = config._url;
			scope._params = config._params;
			scope._columns = config._columns;
			scope._caption = config._caption;
			scope.getHeadHtml();
			
			$.ajax({
				url : scope._url,
				type : "POST",
				data : scope._params,
				dataType : "json",
				success : function(datas){
					
					$("#"+scope._id).html('<table class="table">'+'<caption>'+scope._caption+'</caption>'+scope.getHeadHtml()+scope.getBodyHtml(datas)+'</table>');
					
					if(config.callback){
						config.callback();
					}
				}
			});
		},
		getHeadHtml : function(){
			var scope = this;
			var _html = "<thead><tr>";
			if(scope._columns){
				for(var i=0;i<scope._columns.length;i++){
					_html += "<th>"+scope._columns[i].title+"</th>";
				}
			}
			_html += "</tr></thead>";
			return _html;
		},
		getBodyHtml : function(datas){
			var scope = this;
			var trClass = ["active", "success", "warning", "danger"];
			var _html = "<tbody>";
			if(datas){
				for(var k=0;k<datas.length;k++){
					_html += "<tr class='"+trClass[k%trClass.length]+"'>";
					if(scope._columns){
						for(var i=0;i<scope._columns.length;i++){
							var row = scope._columns[i];
							if(row.title==="NO."){
								_html += "<td>"+(k+1)+"</td>";
							}else{
								if(row.cstyle){
									_html += "<td>"+row.cstyle(datas[k], row.value)+"</td>";
								}else{
									_html += "<td>"+datas[k][row.value]+"</td>";
								}
								
							}
						}
					}
					_html += "</tr>";
				}
			}
			_html += "</tbody>";
			return _html;
		}
};